﻿#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int jc01(int n)
{
	if (n == 1)
		return 1;
	else
		return n * jc01(n - 1);
}

int jc02(int n)
{
	int sum = 1;
	for (; n > 0; n--)
		sum *= n;
	return sum;
}

int main()
{
	int n = 0;
	printf("请输入需要实现阶乘的数字:");
	scanf("%d", &n);
	int a = jc01(n);//用递归的方法实现n的阶乘
	int b = jc02(n);//用非递归的方法实现n的阶乘
	printf("%d %d", a, b);
	return 0;
}